import java.util.List;

import es.deusto.ingenieria.is.csp.formulation.Constraint;
import es.deusto.ingenieria.is.csp.formulation.Variable;

public class AllDiff extends Constraint<Gem> {

	public AllDiff(List<Variable<Gem>> variables, String name){				
		super(name, variables);
	}

	public boolean isSatisfied(Variable<Gem> variable, Gem value) {
		for (Variable<Gem> varAux : this.getVariables()) {
			if (varAux.hasValue() && varAux.getValue().equals(value) && !varAux.equals(variable)) {
				return false;
			}
		}
		
		return true;
	}
}